﻿/* Write a method that asks the user for his name and prints “Hello, <name>” (for example, “Hello, Peter!”). 
 * Write a program to test this method.
 */




using System;
using System.Text.RegularExpressions;

class Hello
{
    static void Main()
    {
        Greet();
    }

    private static void Greet()
    {
        bool iProvied = false;
        string name = null;
        do
        {
            if (iProvied == true) Console.WriteLine("Error: invalid input! Valid chracters are in the range ([a-zA-Z)");
            else iProvied = true;
            Console.Write("Enter your name: ");
        } while (!Regex.Match(name = Console.ReadLine(), "[A-Za-z]+$").Success);
        Console.WriteLine("Hello, {0}!", name);
    }
}
